import actionTypes from "./actionTypes"
import service from '../../service'
export function LoadOrderAction(payload){
  return{
    type:actionTypes.LOAD_ORDER_LIST,
    payload:payload,
  }
}
export function LoadOrderActionAsync(payload){
  return dispatch=>{
    return service.loadOrderList(payload).then((res)=>{
      dispatch(LoadOrderAction(res.data))
    })
  }
}
export function deleteOrderActionAsync(payload){
  return dispatch=>{
    return service.deleteOrder(payload)
  }
}
export function updateOrderActionAsync(payload){
  return dispatch=>{
    return service.updateOrder(payload)
  }
}
export function searchOrderActionAsync(payload){
  return dispatch=>{
    return service.searchOrder(payload).then((res)=>{
      dispatch(LoadOrderAction(res.data))
    })
  }
}